<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body {
      background-color: #ccc;
    }

    #app {
      width: 400px;
      margin: 20px auto;
      background-color: #fff;
      border: 4px solid blueviolet;
      border-radius: 1em;
      box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
      padding: 1em 2em 2em;
    }

    #app h3 {
      text-align: center;
    }

    .title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border: 1px solid #ccc;
      padding: 0 1em;
    }

    .title h4 {
      line-height: 2;
      margin: 0;
    }

    .container {
      border: 1px solid #ccc;
      padding: 0 1em;
    }

    .btn {
      /* 鼠标改成手的形状 */
      cursor: pointer;
    }
  </style>
</head>

<body>
  <div id="app">
    <h3>案例：折叠面板</h3>
    <div>
      <div class="title">
        <h4>芙蓉楼送辛渐</h4>
        <span v-if="flag" class="btn" @click="shower">
           收起
        </span>
        <span v-else="!flag" class="btn" @click="shower" >
            展开
         </span>
      </div>
      <div class="container" v-show="flag">
        <p>寒雨连江夜入吴,</p>
        <p>平明送客楚山孤。</p>
        <p>洛阳亲友如相问，</p> 
        <p>一片冰心在玉壶。</p>
      </div>
    </div>
  </div>
  <!-- 2. 引入vuejs -->
  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
  <script>
    // console.log(false);
    const app = new Vue({
      el: '#app',
      data:{
        index:0,
        msg:['收起','展开'],
        flag:true
     
      },
      methods:{
        shower(){
            this.flag=!this.flag
        //   if(index===1){
        //     this.flag=this.flag
        //   }
           

        }
      }
    })
    console.log(!true); //f
console.log(!"hello"); //u
console.log(!{}); //
console.log(!null); //
console.log(!undefined); //
console.log(!0); //
console.log(![]); //
console.log(!42); //
  </script>

</body>

</html>